home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
020a
/
intgif11.zip
/
INTGIF11.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-07-20
|
10KB
|
443 lines
{-------------------------------------------------------------------------}
{ }
{ IntGIF v.1.1 - Copyright (c) EUROPA Software, 1990 - August 11 }
{ }
{-------------------------------------------------------------------------}
program IntGIF11;
uses dos,crt,param,gifunit;
var cl : ParamArray;
procedure ShowUsage;
begin
write('Usage is: IntGIF [Options] [Filespec]' + crlf + crlf );
write(' Options Are: /H = This Help Screen' + crlf + crlf );
write(' /E = Extensive Details ─╖ ' + crlf );
write(' /M = Medium Details ╟─ Choose Only One' + crlf );
write(' + /L = Limited Details ─╜ ' + crlf + crlf );
write(' /T = Truncate Extra Bytes ─╖ ' + crlf );
write(' + /S = Show Extras But Ignore ╟─ Choose Only One' + crlf );
write(' /I = Ignore Extra Bytes ─╜ ' + crlf + crlf);
write(' - /R = Recurse Directories ' + crlf + crlf );
write(' Default Filespec: *.gif' + crlf + crlf);
write(' "/" or "-" May Be Used to Signal An Option' );
halt(1);
end;
procedure SetParams;
var st : array[1..5] of string;
i,j : byte;
begin
recurse := false;
path := '*.gif';
Detail := Short;
Extra := Medium;
for i := 1 to cl.SwitchCount do
case cl.Switch[i][1] of
'R', 'r' : recurse := true;
'H', 'h' : showUsage;
'E', 'e' : Detail := Extensive;
'M', 'm' : Detail := Medium;
'L', 'l' : Detail := Short;
'T', 't' : Extra := Extensive;
'S', 's' : Extra := Medium;
'I', 'i' : Extra := Short;
else begin
write(crlf + 'Unknown Switch in Command Line: -' +
cl.Switch[i][1] + crlf + crlf);
ShowUsage;
halt(1);
end;
end;
BSize := Sizes[Detail];
if cl.SpecCount > 0 then Path := cl.Spec[1];
end;
procedure ExtensionBlockResults( z : byte );
begin
writeln(crlf + 'Extension Block Function Code: ', z, ' Requested.');
end;
{$F+}
procedure OurExitProc;
begin
writeln;
close(output);
chdir(StartDir);
ExitProc := SaveExitProc;
halt(0);
end;
{$F-}
procedure OneHeading;
const Head : array[1..2] of string =
(( ' Filename Horz Vert Col Global Map ' +
' Color Res. Date Stamp File Size' + crlf +
' -------- ---- ---- --- ---------- ' +
' ---------- ---------- ---------' ),
( ' Filename Horz Vert Col Global Map ' +
' Color Res. Images Lace LZW Bytes' + crlf +
' -------- ---- ---- --- ---------- ' +
' ---------- ------ ---- ---------' ));
begin
case Detail of
1,3 : write( crlf + Head[1] + crlf );
2 : write( crlf + Head[2] + crlf );
end;
end;
procedure ScreenResults;
begin
if (Detail = 3) OR (TotalFiles = 0) then OneHeading;
write( pad(p^.name,12) );
write( rightstr(GH.RWidth,5),
rightstr(GH.RHeight,5),
rightstr(1 shl GH.GBitsPerPixel, 4), ' ');
if GH.GlobalColorMap = 1 then write('Glob. Map ' )
else write('No Glob. ' );
write( GH.GBitsPerPixel:2, ' Bits/Pix' );
case Detail of
1,3: write( ' ', gooddate, ' ', rightstr(p^.Size,9), crlf );
end;
end;
procedure ImageResults;
begin
write( rightstr( ImageNumber,25 ));
write( rightstr( GH.LeftOfs, 7 ));
write( rightstr( GH.TopOfs, 5 ));
write( rightstr( GH.IWidth, 7 ));
write( rightstr( GH.IHeight, 6 ));
write( ' ' + NoYo[GH.LocalColorMap] );
write( ' ' + NoYo[GH.Interlace] );
write( rightstr( ImageBytes, 12) + crlf );
end;
procedure TotalResults;
begin
case Detail of
2: begin
write( ' ', ImageNumber:2, ' Image' );
if ImageNumber > 1 then write('s ') else write(' ');
write(NoYo[GH.Interlace]+rightstr(p^.Size,10)+crlf );
end;
3: begin
blank(65); write( '---------' + crlf);
blank(65); write( rightstr(TotalLZW, 9) + crlf + crlf);
end;
end;
end;
procedure listfiles;
const offx = ' ';
IHead = crlf + ' ' +
'Image Data # Left+ Top+ Horz Vert Local Lace LZW Bytes' + crlf +
offx + '-- ----- ---- ---- ---- ----- ---- ---------' + crlf;
var i : word;
WDir : string;
begin
getdir(0, WDir);
write('Processing Directory: ', WDir, ' ... ' );
BufIdx := GetNames;
if BufIdx = 0 then begin
writeln('No Files Found!');
exit;
end
else begin
write(BufIdx, ' File');
if BufIdx > 1 then writeln('s.') else writeln('.');
end;
p := FileHead;
TotalFiles := 0;
NotGIFs := 0;
repeat
Assign( giffile, p^.name );
Reset( giffile, 1 );
TotalBufIdx := 0;
FileEnd := FileSize(GIFFile);
FillBuffer;
ReadScreenDescriptor;
if IsAGIF then begin
ScreenResults;
inc(TotalFiles);
ControlCode := GetByte;
ImageNumber := 0;
TotalLZW := 0;
while (ControlCode <> GIFTerminator) AND
(NOT (AtEOF) AND
( Detail > 1 )) do begin
case ControlCode of
33: SkipExtensionBlock;
44: begin
if (TotalLZW = 0) AND
(Detail = 3) then write( IHead );
ReadImageDescriptor;
TermByte := getbyte;
ImageBytes := 0;
repeat
BlockSize := GetByte;
if BufIdx+256 < BufEnd then inc(BufIdx, BlockSize)
else for i := 1 to BlockSize do TermByte := GetByte;
inc(ImageBytes, BlockSize);
until ((blocksize = 0) OR (AtEOF));
if Detail = 3 then ImageResults;
inc(TotalLZW, ImageBytes);
end;
else write('Bad Code in file - Possibly Corrupt !');
end;
ControlCode := GetByte;
end;
TotalResults;
end
else inc(NotGIFs);
close(GIFFile);
p := p^.next;
until (p = NIL);
repeat
p := FileHead^.next;
dispose(FileHead);
FileHead := p;
until p = NIL;
if (TotalFiles - NotGIFs) > 0 then writeln;
end;
Procedure NextDir;
var SRec : SearchRec;
MyDir : string[12];
Begin
FindFirst('*.*',AnyFile,SRec);
while DosError = 0 do begin
If (SRec.Attr = Directory) and (SRec.Name[1] <> '.') then begin
ChDir(SRec.Name);
MyDir := SRec.Name;
listfiles;
NextDir;
ChDir('..');
end;
FindNext(SRec);
end;
End;
begin
SaveExitProc := ExitProc;
ExitProc := @OurExitProc;
TotalFiles := 0;
NotGIFs := 0;
recurse := false;
getdir(0,StartDir);
writeln('IntGIF v.1.1 - GIF Image Interrogator');
writeln('Copyright (c) 1990, EUROPA Software [jec]' + crlf);
if ParseCommandLine( cl ) then SetParams
else begin
writeln('Error in Command Line');
halt(1);
end;
if Path = '' then begin
write( 'Enter GIF Filename to Interrogate: ');
Readln( Path );
end;
assign(output,'');
rewrite(output);
fsplit(path, D, N, E);
path := D;
mask := N + E;
{$I-}
If Path[length(Path)] = '\' then Path[Length(Path)] := ' ';
if length(path) > 1 then
If Path[Length(Path)-1] = ':' then Path[Length(Path)] := '\';
{$I-}
ChDir(Path);
If IOResult <> 0 then Begin
writeln(' ',Path,' is not a valid directory.');
writeln;
ChDir(StartDir);
halt(1);
end;
{$I+}
GetDir(0,CurrentDir);
new(buf);
listfiles;
if recurse then NextDir;
dispose(buf);
ChDir(StartDir);
end.